Split file system

ABSTRACT

A file system for a collection of data files on a microcontroller-based device, the microcontroller-based device including an arithmetic/logic unit, read/write memory, and program memory, and the file system comprising a data table stored in the program memory and a document table of contents stored on a host computer. The data table is a set of data files, and the document table of contents includes length and offset information for each data file. A method is also described for creating and managing a file system for a collection of data files on a microcontroller-based device, wherein the microcontroller-based device includes an arithmetic/logic unit, read/write memory, and program memory, wherein the method comprises the steps of providing a data table for storage in the program memory and providing a document table of contents for storage on a host computer.

FIELD OF THE INVENTION

[0001] This invention relates generally to file systems for microcomputer-based devices having limited system resources and in particular to data files used to specify and create interfaces for microcomputer-based devices acting as specialized web servers, and is more particularly directed toward a method and system that places a minimum set of software routines for accessing the microcomputer-based system's data store within the embedded controller itself, while placing all higher level software components of a file system within a host computer.

BACKGROUND OF THE INVENTION

[0002] In general, the term “embedded system” connotes a combination of computer hardware and software that forms a component of some larger system. Embedded systems are intended to operate without intervention by the larger system of which they form a part, and without the need for frequent control or supervisory inputs from any source. Embedded systems are usually of simple design, and often do not include mass storage components or complex peripherals.

[0003] Embedded systems have been placed in vending machines to provide a simple computer network interface to report the need for service or vended product replenishment. Some copying machines in the office environment also utilize embedded systems for reporting of operational status, and embedded systems have been suggested in television set-top boxes designed to provide Internet web browser features through the viewer's television set.

[0004] Embedded systems that are accessible over computer networks may be configured, for example, as specialized web servers designed for Internet access. In general, this web server function is restricted to embedded device interface. But the device must usually be able to supply data files used to specify and create interfaces.

[0005] In order to minimize space required for storing data files within the limited non-volatile memory of an embedded system, which would generally be limited to a few thousand bytes (8-bit memory locations) of EEPROM (electrically erasable, programmable read-only memory), a few fixed-length data files with a fixed address table could be provided. This type of data structure still requires storage space for the address table and a minimal file access utility (a READ routine, for example) to access the stored data.

[0006] While this stripped-down data structure may be adequate for some application, it lacks the flexibility to operate in an environment where data files may need to be altered, removed, or added. Accordingly, a need arises for a flexible file system designed to operate in conjunction with a microcomputer-based system having limited storage capability. Such a file system should provide a range of file system services while preserving as much as possible of the embedded system's storage capability for the data files themselves.

SUMMARY OF THE INVENTION

[0007] These needs and others are satisfied by the method of the present invention for a file system for a collection of data files on a microcontroller-based device, the microcontroller-based device including an arithmetic/logic unit, read/write memory, and program memory, and the file system comprising a data table stored in the program memory and a document table of contents stored on a host computer. The data table is a set of data files, and the document table of contents includes length and offset information for each data file.

[0008] In one aspect of the invention, the set of data files may be a concatenated set of compressed data files. The file system may further comprise means for accessing the document table of contents on the host computer to retrieve the length and offset information and means for retrieving the desired data file using the retrieved length and offset information.

[0009] In one form of the invention, at least one of the collection of data files may be a rich text document, such as an HTML document, although this is not a requirement for a system in accordance with the invention.

[0010] In accordance with another aspect of the invention, a method is described for creating and managing a file system for a collection of data files on a microcontroller-based device, wherein the microcontroller-based device includes an arithmetic/logic unit, read/write memory, and program memory. The method comprises the steps of providing a data table for storage in the program memory and providing a document table of contents for storage on a host computer.

[0011] The step of providing a data table further comprises the steps of compressing each file in a set of desired files and concatenating the compressed files to form the data table. The document table of contents includes file length and file offset information.

[0012] In accordance with one form of the invention, a desired file is accessed by the steps of retrieving length and offset information relating to the desired data file from the document table of contents on the host computer and accessing the desired data file in the program memory using the retrieved length and offset information.

[0013] In another form of the invention, a file system is provided having software components distributed over a computer network, wherein one element of the computer network is a microcontroller-based device including an arithmetic/logic unit, read/write memory, program memory, and non-volatile memory, and another element of the computer network is a host computer system. The file system comprises a collection of data files stored in the non-volatile memory of the microcontroller-based device, byte-oriented non-volatile memory access routines stored in the program memory of the microcontroller-based device, and file-oriented access routines stored on the host computer, wherein the file-oriented access routines provide directory and file manipulation capability for the data files stored in the non-volatile memory of the microcontroller-based device.

[0014] The data files in the non-volatile memory of the microcontroller-based device are configured as an array of writable blocks. The memory access routines described in conjunction with the file system may comprise a read routine that reads a range of memory locations from the non-volatile memory and a write routine that writes to a single memory location.

[0015] A start address and a number of memory locations to be read may be passed to the read routine as parameters, while a memory address and a value to be written may be passed to the write routine as parameters.

[0016] In yet another form of the invention, a method is described for creating and managing a file system having software components distributed over a computer network, wherein one element of the computer network is a microcontroller-based device including an arithmetic/logic unit, read/write memory, program memory, and non-volatile memory, and another element of the computer network is a host computer system. The method comprises the steps of providing a collection of data files stored in the non-volatile memory of the microcontroller-based device, providing byte-oriented non-volatile memory access routines stored in the program memory of the microcontroller-based device, and providing file-oriented access routines stored on the host computer. The collection of data files stored in the non-volatile memory of the microcontroller-based device may be a collection of compressed data files.

[0017] In yet another aspect of the present invention, a method is provided for maintaining a file system for one or more files stored in non-volatile memory of a microcontroller-based device, wherein the microcontroller-based device is in communication with a host computer over a computer network. The method comprises the steps of providing byte-oriented non-volatile memory access routines stored in the program memory of the microcontroller-based device, providing, on the host computer, file-oriented access routines, and maintaining, on the host computer, a directory and a free block list characterizing the files stored on the microcontroller-based device and the file storage space available.

[0018] Updating a file stored on the microcontroller-based device further includes the steps of maintaining, on the host computer, a copy of the file to be updated, compressing the copy of the file, determining file length, examining the free block list to determine whether number of block required for file storage has changed, and, if so, modifying the free block list to reflect new block allocation, storing the file in blocks as allocated in the free block list, updating a directory entry corresponding to the file being updated, and writing the file to the microcontroller-based device utilizing the byte-oriented access routines in the program memory of the microcontroller-based device. This process may further include the step of updating a transaction counter stored both on the microcontroller-based device and on the host computer.

[0019] In still another form of the invention, a file system comprises a data table stored in memory associated with a device and a software module on a host computer system interconnected with the device, wherein the software module interprets the data table. The table may be grouped into logical blocks of data, while the logical blocks may comprise an arrangement including a directory structure, a free block list, and sequences of blocks that store contents of a file.

[0020] Further objects, features, and advantages of the present invention will become apparent from the following description and drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

[0021]FIG. 1 illustrates, in block diagram form, the general structure and operation of a split file system in accordance with the present invention;

[0022]FIG. 2 depicts the data organization of a split file system in accordance with the present invention; and

[0023]FIG. 3 is a flow chart of a method for maintaining a file system for one or more files stored in non-volatile memory of a microcontroller-based device in accordance with the present invention.

DETAILED DESCRIPTION OF THE INVENTION

[0024] In accordance with the present invention, a methodology and system for providing file system services for embedded systems is described that provide distinct advantages when compared to those of the prior art.

[0025] One method for storing files on an embedded device, which could be termed static document storage, creates a file system at the time the firmware of the embedded system is created, presumably on a development system by the system developer as is well-known in the art. This is accomplished by placing the embedded system data files into a single target directory on the development system computer and executing a utility program that compresses each of the files in the directory, then concatenates the files into a single large data table.

[0026] The compression technique used may be any suitable file compression scheme, but is preferably based up a Lempel-Ziv (LZ) substitutional compression, as is well-known in the art. In the preferred form of the invention, the compression is a variant of the Storer/Szymanski scheme in which a window of predetermined size is maintained in conjunction with a look-ahead buffer, and additional dynamic Huffman compression is applied to the basic compressor output. This is known as LZH compression.

[0027] The data table described above is added to the program in the embedded device firmware. The offset and length of each file are stored in the embedded device as a static document table of contents. This static document table of contents is also retained by the host computer. This process creates a complete, although primitive, file system on the target system so that document access does not require host participation.

[0028] The static document storage technique described above has the advantage that it prevents files from being corrupted or altered. This same characteristic can become a liability, however, should a file require alteration for a legitimate reason. Reasons for updating a data file may include, for example, updating a user interface for a different language, or correcting an error in the interface program. The static technique also uses the microcontroller's program memory for document data storage, and program memory is generally in short supply in a microcontroller-based system.

[0029] To overcome these difficulties, the split file system allows for dynamic document storage by placing most of the file system on the host computer 101 and using the non-volatile memory 103 associated with the embedded device for storage of document data. In general, a file system is a module that breaks up a storage device into blocks that are in turn logically related into files. The purpose of this decomposition of the storage device into blocks is to provide a pool of storage units from which to allocate strings of blocks of file data. The individual blocks may be allocated and deleted as needed without affecting neighboring blocks that may be associated with other files.

[0030] The blocks are allocated and deleted by the file system as files are created, destroyed, or resized. These operations are made possible by a data structure that records the files currently stored in the file system, and the sequence of data blocks that represents the contents of each of the files. Thus, a file system takes a fixed size storage space and allows files (whose lengths are generally unknown a priori) to be added and removed without requiring that all the other files on the storage device be moved in order to make room, or that any gaps that may be left by any missing files be closed.

[0031] A file system module that provides the above-described capabilities can be quite large in terms of code space required to implement it. A typical robust file system uses ten times the code space that is available on most single chip micro-controllers.

[0032] The environment in which the present invention is designed to operate contemplates that the embedded system will be connected to a host computer. This interconnection of embedded system and host may occur in the context of a web browser/web server connection commonly encountered during Internet operation, but the interconnection is not limited to this Internet scenario.

[0033] The present invention addresses the above-described file system size problem by moving the file system code onto the host computer that is connected to the embedded device. The embedded device simply provides a section of memory, typically on serial EEPROM, and low-level routines to read and write this memory. The remainder of the file system software, such as that required to provide a completely dynamic document storage capability (including, for example, the capability to add and remove files at run time) resides on the host computer. This means that the device contains all the files and data that comprise a file system, but there is little or no overhead for the file system within the embedded device.

[0034] Of course, the end result of placing the file system utilities on the host computer instead of the embedded system is that the embedded system (or “embedded device”) cannot “understand” the contents of portions of it's own memory. This has little or no effect on device operation, however, since the files and data that reside in this portion of memory are actually used only by the host computer to interface with the embedded system, so the device does not require access to its own data files without the help of the host.

[0035]FIG. 1 illustrates, in block diagram form, the general structure and operation of a split file system in accordance with the present invention, generally depicted by the numeral 100. An embedded microcontroller 102 stores files and data within an associated non-volatile memory device 103.

[0036] The embedded device 102 may be a thermostat, for example, designed to be controlled via an Internet connection. Since Internet operation supports a wide variety of graphics-rich display modes, a graphical interface with the thermostat would be a desirable feature. A thermostat control panel could be represented as an HTML (Hypertext Markup Language) file stored within the embedded device 102. If a web browser attempts to load the control panel, the HTML file is retrieved from the device 102 through the intervention of the host computer 101. The host 101 provides file system services both to other programs that may be running on the host, or to programs running remotely through a network such as the Internet.

[0037] It should be noted that the file format for data storage on the embedded device 102 is not limited to HTML, but may be any format that provides adequate functionality. Similarly, the present invention is not limited to operation over the Internet, but may be used for communication between systems that are directly connected, systems that are part of a private local or wide-area network (an Intranet connection), or for systems that communicate via the Internet.

[0038] As noted above, in the split file system environment, the host computer provides file system services to other programs on the host, and to programs running remotely on a computer network. These services include, but are not limited to: INSERT FILE, DELETE FILE, READ DIRECTORY, UPDATE DIRECTORY, and READ FILE. At a minimum, the device itself must contain non-volatile memory access routines that allow individual bytes to be written to and read. These low-level routines may be termed READ BYTE and WRITE BYTE. For the sake of convenience, and if memory limitations allow, additional routines that permit the reading and writing of a range of bytes in the non-volatile memory may be provided. The ability to read and write a range of bytes enhances data transfer rate.

[0039]FIG. 2 depicts the data organization of a split file system in accordance with the present invention, and is generally depicted by the numeral 200. The file system 200 is implemented in an array of writable blocks 201. The first block after the file system header 202 is the first directory block, and each block contains a pointer to the next block. A free block pointer in the header points to the first free block. Each file corresponding to a directory entry has a pointer to the first block of the file, and, just as in the directory structure, each allocated block of a file includes a pointer to the next block.

[0040]FIG. 3 is a flow chart of a method for maintaining a file system in accordance with the present invention, and is particularly directed toward maintaining a file. A copy of the file to be updated is generally maintained, as indicated in block 301. This file copy is generally kept in the memory of the host system.

[0041] In the subsequent step (302), the file copy is compressed using a suitable compression scheme as discussed previously. Next, in step 303, the file length is determined. The free block list is then examined in step 304 to determine whether the number of blocks required for file storage has changed.

[0042] If so, execution proceeds in block 306 as the free block list is modified to reflect the new block allocation. In the next step (307), the file is stored in blocks as allocated in the free block list. This is the same step (307) where execution resumes if the number of blocks required for storage has not changed. In other words, the free block list is not modified if the number of blocks required for file storage has not changed.

[0043] In the subsequent step (308), the directory entry for the file is updated. Then, in step 309, the file is written to the microcontroller-based device utilizing the byte-oriented access routines in the program memory of the device.

[0044] In addition to presenting an innovative solution to the problem of creating and managing a file system for a small, embedded device, the above-described system and methodology also anticipates and provides solutions to other potential problems.

[0045] First, since the connection to an embedded device may be a tenuous one (via telephone line or RF modem, for example), the embedded device may lose its connection with the host system. If communication were interrupted during file system operations, the file system could be corrupted. In the file system invention described, a local copy of the file system is kept on the host computer. All modifications to the file system are performed on this local copy, and the modified regions are not transmitted to the embedded device until the local copy is ready. A transaction counter at both the local and remote ends provides a way for the file system software to check whether the device has been successfully updated to reflect the latest file system state. And, in the event of communication disruption, the host system can check to see if it should complete a previously failed file system update.

[0046] Another problem that may arise in connection with the establishment of a file system associated with an embedded device is the high rate of state changes that could occur during modification of the non-volatile memory during a typical modification session. Since most EEPROMs permit only a finite (albeit large) number of write operations, the permissible write count could be exceeded in a relatively short time. To avoid this pitfall, write operations to the device memory are deferred by setting a flag in the split file system driver. The flag is set at the beginning of a modification session (telling the driver not to synchronize transactions), then cleared when the local copy of the file system is in the desired final state. This technique results in reduced communication traffic during development and update, as well as reducing the total write count of EEPROMs used for storage.

[0047] Finally, since memory in the embedded device is often at a premium, internal fragmentation resulting from fixed length block size is eliminated by using a “squeeze” function to resize all file storage blocks to exactly the size needed for data storage. This is similar to the cluster resize operation of some software products, but different because the block size itself is modified to fit exactly rather than simply to fit better.

[0048] The concept of a split file system also includes the logical concatenation of files in the device, as described above, with a set of files on the host computer which are associated with the device. A set of files on the host may be identified as follows:

[0049] c:\emware\dev\myhvac\foo.html

[0050] c:\emware\dev\myhvac\pigs.bin

[0051] In device memory, the following files may be stored:

[0052] Start.html

[0053] ex11.html

[0054] As seen from a client, the entire collection of files would be available as:

[0055] foo.html

[0056] pigs.bin

[0057] Start.html

[0058] ex11.html

[0059] There have been described herein a protocol and methodology for information interchange for embedded systems communicating over computer networks that are relatively free from the shortcomings of the prior art. It will be apparent to those skilled in the art that modifications may be made without departing from the spirit and scope of the invention. Accordingly, it is not intended that the invention be limited except as may be necessary in view of the appended claims. 

What is claimed is:
 1. A file system for a collection of data files on a microcontroller-based device, the microcontroller-based device including: an arithmetic/logic unit; read/write memory; and program memory; wherein the file system comprises: a data table stored in the program memory; and a document table of contents stored on a host computer.
 2. The file system in accordance with claim 1 , wherein the data table is a set of data files, and the document table of contents includes length and offset information for each data file.
 3. The file system in accordance with claim 2 , wherein the set of data files is a concatenated set of compressed data files.
 4. The file system in accordance with claim 2 , further comprising: means for accessing the document table of contents on the host computer to retrieve the length and offset information; and means for retrieving the desired data file using the retrieved length and offset information.
 5. The file system in accordance with claim 1 , wherein at least one of the collection of data files is a rich text document.
 6. The file system in accordance with claim 5 , wherein the rich text document is an HTML document.
 7. A method for creating and managing a file system for a collection of data files on a microcontroller-based device, wherein the microcontroller-based device includes: an arithmetic/logic unit; read/write memory; and program memory; wherein the method comprises the steps of: (a) providing a data table for storage in the program memory; and (b) providing a document table of contents for storage on a host computer.
 8. The method in accordance with claim 7 , wherein the step of providing a data table further comprises the steps of: (a) compressing each file in a set of desired files; and (b) concatenating the compressed files to form the data table.
 9. The method in accordance with claim 7 , wherein the document table of contents includes file length and file offset information.
 10. The method in accordance with claim 9 , wherein a desired file is accessed by the steps of: (a) retrieving length and offset information relating to the desired data file from the document table of contents on the host computer; and (b) accessing the desired data file in the program memory using the retrieved length and offset information.
 11. A file system having software components distributed over a computer network, wherein one element of the computer network is a microcontroller-based device including: an arithmetic/logic unit; read/write memory; program memory; and non-volatile memory; and another element of the computer network is a host computer system, the file system comprising: a collection of data files stored in the non-volatile memory of the microcontroller-based device; byte-oriented non-volatile memory access routines stored in the program memory of the microcontroller-based device; and file-oriented access routines stored on the host computer; wherein the file-oriented access routines provide directory and file manipulation capability for the data files stored in the non-volatile memory of the microcontroller-based device.
 12. The file system in accordance with claim 11 , wherein the data files in the non-volatile memory of the microcontroller-based device are configured as an array of writable blocks.
 13. The file system in accordance with claim 11 , wherein the memory access routines comprise: a read routine that reads a range of memory locations from the non-volatile memory; and a write routine that writes to a single memory location.
 14. The file system in accordance with claim 13 , wherein a start address and a number of memory locations to be read are passed to the read routine as parameters.
 15. The file system in accordance with claim 13 , wherein a memory address and a value to be written are passed to the write routine as parameters.
 16. A method for creating and managing a file system having software components distributed over a computer network, wherein one element of the computer network is a microcontroller-based device including: an arithmetic/logic unit; read/write memory; program memory; and non-volatile memory; and another element of the computer network is a host computer system, the method comprising the steps of: (a) providing a collection of data files stored in the non-volatile memory of the microcontroller-based device; (b) providing byte-oriented non-volatile memory access routines stored in the program memory of the microcontroller-based device; and (c) providing file-oriented access routines stored on the host computer.
 17. The method in accordance with claim 16 , wherein the collection of data files stored in the non-volatile memory of the microcontroller-based device is a collection of compressed data files.
 18. A method for maintaining a file system for one or more files stored in non-volatile memory of a microcontroller-based device, wherein the microcontroller-based device is in communication with a host computer over a computer network, the method comprising the steps of: (a) providing byte-oriented non-volatile memory access routines stored in the program memory of the microcontroller-based device; (b) providing, on the host computer, file-oriented access routines; and (c) maintaining, on the host computer, a directory and a free block list characterizing the files stored on the microcontroller-based device and the file storage space available.
 19. The method in accordance with claim 18 , wherein updating a file stored on the microcontroller-based device further includes the steps of: (d) maintaining, on the host computer, a copy of the file to be updated; (e) compressing the copy of the file; (f) determining file length; (g) examining the free block list to determine whether number of block required for file storage has changed; and, if so (h) modifying the free block list to reflect new block allocation; (i) storing the file in blocks as allocated in the free block list; (j) updating a directory entry corresponding to the file being updated; and (k) writing the file to the microcontroller-based device utilizing the byte-oriented access routines in the program memory of the microcontroller-based device.
 20. The method in accordance with claim 19 , further comprising the step of updating a transaction counter stored both on the microcontroller-based device and on the host computer.
 21. A file system comprising: a data table stored in memory associated with a device; and a software module on a host computer system interconnected with the device, wherein the software module interprets the data table.
 22. The file system of claim 21 , wherein the table is grouped into logical blocks of data.
 23. The file system of claim 22 , wherein the logical blocks comprise an arrangement including: a directory structure; a free block list; and sequences of blocks that store contents of a file. 